﻿using System;
using Steamworks;
using Terraria.Social.Base;

namespace Terraria.Social.Steam
{
	// Token: 0x0200013D RID: 317
	public class OverlaySocialModule : OverlaySocialModule
	{
		// Token: 0x06000D88 RID: 3464 RVA: 0x0000D6E1 File Offset: 0x0000B8E1
		public override void Initialize()
		{
			this._gamepadTextInputDismissed = Callback<GamepadTextInputDismissed_t>.Create(new Callback<GamepadTextInputDismissed_t>.DispatchDelegate(this.OnGamepadTextInputDismissed));
		}

		// Token: 0x06000D89 RID: 3465 RVA: 0x00006B58 File Offset: 0x00004D58
		public override void Shutdown()
		{
		}

		// Token: 0x06000D8A RID: 3466 RVA: 0x0000D6FA File Offset: 0x0000B8FA
		public override bool IsGamepadTextInputActive()
		{
			return this._gamepadTextInputActive;
		}

		// Token: 0x06000D8B RID: 3467 RVA: 0x003F82F8 File Offset: 0x003F64F8
		public override bool ShowGamepadTextInput(string description, uint maxLength, bool multiLine = false, string existingText = "", bool password = false)
		{
			if (this._gamepadTextInputActive)
			{
				return false;
			}
			bool flag = SteamUtils.ShowGamepadTextInput(password ? 1 : 0, multiLine ? 1 : 0, description, maxLength, existingText);
			if (flag)
			{
				this._gamepadTextInputActive = true;
			}
			return flag;
		}

		// Token: 0x06000D8C RID: 3468 RVA: 0x003F8334 File Offset: 0x003F6534
		public override string GetGamepadText()
		{
			uint enteredGamepadTextLength = SteamUtils.GetEnteredGamepadTextLength();
			string result;
			SteamUtils.GetEnteredGamepadTextInput(ref result, enteredGamepadTextLength);
			return result;
		}

		// Token: 0x06000D8D RID: 3469 RVA: 0x0000D702 File Offset: 0x0000B902
		private void OnGamepadTextInputDismissed(GamepadTextInputDismissed_t result)
		{
			this._gamepadTextInputActive = false;
		}

		// Token: 0x040011E9 RID: 4585
		private Callback<GamepadTextInputDismissed_t> _gamepadTextInputDismissed;

		// Token: 0x040011EA RID: 4586
		private bool _gamepadTextInputActive;
	}
}
